package com.controller;

import com.entity.Category;
import com.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @ResponseBody
    @RequestMapping("/getCategoryByParentId")
    public Object getCategoryByParentId(String parentId) {
        List<Category> categoryList = categoryService.findCategoryByParentId(parentId);
       /* System.out.println(categoryList);
        for (Category c : categoryList) {
            System.out.println(c);
        }*/
        return categoryList;
    }
}
